# coding=utf-8
import enum
import json


class ShowCode(enum.Enum):
    SUCCESS = 200
    ERROR = 500


def show_result(code, data={}):
    show_success = {"code": ShowCode.SUCCESS.value, "msg": '加载成功', "data": {}}
    show_error = {"code": ShowCode.ERROR.value, "msg": '加载失败', "data": {}}
    show_dict = {
        ShowCode.SUCCESS: show_success,
        ShowCode.ERROR: show_error
    }
    result = show_dict[code]
    result["data"] = json.dumps(data, ensure_ascii=False)
    return result
